import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    // redirect: '/areaDetail',
    component: Home
  },
  // 详情页
  {
    path: '/areaDetail',
    redirect: '/areaDetail/data',
    component: () => import('../views/Detail.vue'),
    children: [
      // 数据统计
      {
        path: '/areaDetail/data',
        component: () => import('../views/details/DataStatistics.vue')
      },
      // 修改密码
      {
        path: '/areaDetail/updatepwd',
        component: () => import('../views/details/UpdatePwd.vue')
      },
      // 管理员账号管理
      {
        path: '/areaDetail/adminManage',
        component: () => import('../views/details/AdminManage.vue')
      },
      // 添加管理员账号
      {
        path: '/areaDetail/addAdmin',
        component: () => import('../views/details/AddAdmin.vue')
      },
      // 学校信息
      {
        path: '/areaDetail/schoolMsg',
        component: () => import('../views/details/SchoolMsg.vue')
      },
      // 资源统计报表
      {
        path: '/areaDetail/resouce',
        component: () => import('../views/details/ResourceList.vue')
      },
      // 考试记录
      {
        path: '/areaDetail/examRecord',
        component: () => import('../views/details/ExamRecord.vue')
      },
      // 新建考试
      {
        path: '/areaDetail/addExam',
        component: () => import('../views/details/AddExam.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
